<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="s_search" :rules="rules" label-width="100px" id="mvcfm"> 退货条形码 <div class="el-select">
        <el-input v-model="s_search.stock_num" />
      </div> 退货仓库 <el-select v-model="s_search.firm_id" @change="list_s_firm">
        <el-option label="－－无－－" value='' />
        <el-option v-for="dict in s_firm" :key="dict.__code" :label="dict.__desc" :value="dict.__code"></el-option>
      </el-select> 退货区域 <el-select v-model="s_search.s_layout_item">
        <el-option label="－－无－－" value='' />
        <el-option v-for="dict in s_layout_item" :key="dict.__code" :label="dict.__desc" :value="dict.__code"></el-option>
      </el-select> 退货产品 <div class="el-select">
        <el-input v-model="s_search.product_name" />
      </div> 退货供应商 <div class="el-select">
        <el-input v-model="s_search.client_name" />
      </div> 退货日期
      <el-date-picker v-model="s_search.store_intime" type="date" value-format="yyyy-MM-dd" />
      <el-button @click="('')" type='success' size="mini"><i class='fa fa-check'></i>搜索</el-button>
      <div>
      </div>
      <div class="form-unit">
        <span class="mvc-title-left"> 退货查询 </span>
      </div>
      <el-table :data="s_record">
        <el-table-column label="#" align="center" type='index'>
        </el-table-column>
        <el-table-column label="退货条形码" prop="stock_id">
          <template slot-scope="scope">
            <el-link @click="gotoPage('/psi/supplychainmana/ReturnProDet?stock_id='+scope.row.stock_id+''+vueparams+'')" type='primary'>{{scope.row.stock_barcode}}</el-link>
          </template>
        </el-table-column>
        <el-table-column label="退货供应商" prop="client_name">
        </el-table-column>
        <el-table-column label="产品名称" prop="product_name">
        </el-table-column>
        <el-table-column label="规格型号" prop="norm_model">
        </el-table-column>
        <el-table-column label="仓库区域" prop="name">
        </el-table-column>
        <el-table-column label="退货价格" prop="product_price">
        </el-table-column>
        <el-table-column label="退货数量" prop="product_num">
        </el-table-column>
        <el-table-column label="退货时间" prop="record_intime">
          <template slot-scope="scope">
            {{getDateTimeString(scope.row,'record_intime')}}
          </template>
        </el-table-column>
        <el-table-column label="操作人" prop="contact_name">
        </el-table-column>
      </el-table>
      <pagination v-show="total>0" :total="total" :limit.sync="pageSize" @pagination="getPage" />
    </el-form>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'ReturnList',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        s_search: {
          stock_num: null,
          firm_id: null,
          s_layout_item: null,
          product_name: null,
          client_name: null,
          store_intime: null,
        },
        s_record: [],
        s_firm: [],
        s_layout_item: [],
        loading: false,
        rules: {}
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/psi/supplychainmana/ReturnProAction/returnList?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      list_s_firm(value) {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/psi/supplychainmana/ReturnProAction/ajaxReturnList?' + this.vueparams,
          params: {
            htmltable: '',
            cfield_name: "s_layout_item",
            firm_id: value
          }
        }).then(data => {
          this.$set(this.s_search, 's_layout_item', '');
          this.s_layout_item = data['s_layout_item'];
        })
      },
    },
  }
</script>
